﻿using Prism.Events;
using Prism.Mvvm;
using System.Windows;

namespace Module.CanJuSheJi.ViewModels
{
    public class ChessBoardViewModel : BindableBase
    {
        private readonly IEventAggregator Ea;
        private readonly string ClassName; // 用于记录消息发出的位置

        private bool _fanZhuanQipan;
        public bool FanZhuanQipan   // 棋盘翻转状态
        {
            get { return _fanZhuanQipan; }
            set
            {
                SetProperty(ref _fanZhuanQipan, value);
                if (_fanZhuanQipan) { RedUp = Visibility.Visible; BlackUp = Visibility.Hidden; }
                else { RedUp = Visibility.Hidden; BlackUp = Visibility.Visible; }

                // 此处棋盘更换处理代码
            }
        }

        private Visibility _redUp; // 红方在上
        public Visibility RedUp { get { return _redUp; } set { SetProperty(ref _redUp, value); } }

        private Visibility _blackUp; // 黑方在上
        public Visibility BlackUp { get { return _blackUp; } set { SetProperty(ref _blackUp, value); } }


        /// <summary>
        /// 棋盘类的ViewModel
        /// </summary>
        /// <param name="ea"></param>
        public ChessBoardViewModel(IEventAggregator ea)
        {
            this.Ea = ea;
            ClassName = this.GetType().Name;
            FanZhuanQipan = false; // 初始为黑方在上
        }
    }
}
